//
//  CEPiontHeaderView.m
//  digitalCurrency
//
//  Created by 默认账户 on 2019/4/3.
//  Copyright © 2019 XinHuoKeJi. All rights reserved.
//

#import "CEPiontHeaderView.h"

@interface CEPiontHeaderView ()
@property (nonatomic, strong) UILabel *firstL;
@property (nonatomic, strong) UILabel *secondL;
@property (nonatomic, strong) UILabel *thirdL;

@end

@implementation CEPiontHeaderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createviews];
    }
    return self;
}

- (void)createviews {
    if (self.firstL) {
        return;
    }
    
    UIView *topView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 15)];
    [self addSubview:topView];
    topView.backgroundColor = [UIColor blackColor];
    
    CGFloat viewwidth = SCREEN_WIDTH-48;
    
    for (int i = 0; i < 3; i++) {
        UILabel *firstL = [[UILabel alloc] init];
        firstL.textColor = [UIColor whiteColor];
        firstL.font = [UIFont systemFontOfSize:15];
        [self addSubview:firstL];
        if (i == 0) {
            self.firstL  = firstL;
        }
        else if (i == 1) {
            self.secondL = firstL;
            firstL.textAlignment = NSTextAlignmentCenter;
        }
        else {
            self.thirdL  = firstL;
            firstL.textAlignment = NSTextAlignmentRight;
        }
        
        [firstL mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(15);
            make.left.mas_equalTo(24 + (i*viewwidth/3.0));
            make.height.mas_equalTo(49);
            make.width.mas_equalTo(viewwidth/3.0);
        }];
    }
}

- (void)setTitles:(NSArray *)titles {
    self.firstL.text = titles[0];
    self.secondL.text = titles[1];
    self.thirdL.text = titles[2];
}

@end
